<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
</head>
<body>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
	<form class="form-horizontal" onsubmit="return false" id="form">
		<fieldset>
			<input type="hidden" id="id" name="id">
			<div class='form-group'>
				<label class='col-md-2 control-label'>productId</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='productId' type='text' name='productId' id='productId' data-bv-notempty='true' data-bv-notempty-message='productId 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>specificationsId</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='specificationsId' type='text' name='specificationsId' id='specificationsId' data-bv-notempty='true' data-bv-notempty-message='specificationsId 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>mailId</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='mailId' type='text' name='mailId' id='mailId' data-bv-notempty='true' data-bv-notempty-message='mailId 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>actualPrice</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='actualPrice' type='text' name='actualPrice' id='actualPrice' data-bv-notempty='true' data-bv-notempty-message='actualPrice 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>mallType</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='mallType' type='text' name='mallType' id='mallType' data-bv-notempty='true' data-bv-notempty-message='mallType 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>itemupshelfTotal</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='itemupshelfTotal' type='text' name='itemupshelfTotal' id='itemupshelfTotal' data-bv-notempty='true' data-bv-notempty-message='itemupshelfTotal 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>totalInventory</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='totalInventory' type='text' name='totalInventory' id='totalInventory' data-bv-notempty='true' data-bv-notempty-message='totalInventory 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>virtualInventory</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='virtualInventory' type='text' name='virtualInventory' id='virtualInventory' data-bv-notempty='true' data-bv-notempty-message='virtualInventory 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>sales</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='sales' type='text' name='sales' id='sales' data-bv-notempty='true' data-bv-notempty-message='sales 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>returnWing</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='returnWing' type='text' name='returnWing' id='returnWing' data-bv-notempty='true' data-bv-notempty-message='returnWing 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>whether</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='whether' type='text' name='whether' id='whether' data-bv-notempty='true' data-bv-notempty-message='whether 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>universalCoupon</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='universalCoupon' type='text' name='universalCoupon' id='universalCoupon' data-bv-notempty='true' data-bv-notempty-message='universalCoupon 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>discount</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='discount' type='text' name='discount' id='discount' data-bv-notempty='true' data-bv-notempty-message='discount 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>goodsDiscount</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='goodsDiscount' type='text' name='goodsDiscount' id='goodsDiscount' data-bv-notempty='true' data-bv-notempty-message='goodsDiscount 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>themeActivities</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='themeActivities' type='text' name='themeActivities' id='themeActivities' data-bv-notempty='true' data-bv-notempty-message='themeActivities 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>cssId</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='cssId' type='text' name='cssId' id='cssId' data-bv-notempty='true' data-bv-notempty-message='cssId 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>creater</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='creater' type='text' name='creater' id='creater' data-bv-notempty='true' data-bv-notempty-message='creater 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>updater</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='updater' type='text' name='updater' id='updater' data-bv-notempty='true' data-bv-notempty-message='updater 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>conventionalNote</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='conventionalNote' type='text' name='conventionalNote' id='conventionalNote' data-bv-notempty='true' data-bv-notempty-message='conventionalNote 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>conventionalRemark</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='conventionalRemark' type='text' name='conventionalRemark' id='conventionalRemark' data-bv-notempty='true' data-bv-notempty-message='conventionalRemark 不能为空'>
				</div>
			</div>



			<div class="form-actions">
				<div class="row" align="center">
					<div class="col-md-12">
					    <button class="btn btn-primary" onclick="location.href='tswConventionalGoodList.html'">返回</button>
						<button class="btn btn-primary" type="submit" onclick="update()">
							<i class="fa fa-save"></i> 保存
						</button>
					</div>
				</div>
			</div>

		</fieldset>
	</form>
</div>
	<script type="text/javascript" src="../../js/libs/jquery-2.1.1.min.js"></script>
	<script type="text/javascript" src="../../js/jq.js"></script>
	<script type="text/javascript" src="../../js/plugin/bootstrapvalidator/bootstrapValidator.min.js"></script>
	<script type="text/javascript" src="../../js/common.js"></script>
	<script type="text/javascript" src="../../layui/layui.js"></script>
	<script type="text/javascript">
		layui.use(['layer','laydate'], function(){
		    var layer = layui.layer;
		});
		
		initData();
		
		function initData(){
			var id = getUrlParam("id");
			if(id != ""){
				$.ajax({
					type : 'get',
					url : '/tswConventionalGoods/'+id,
					async : false,
					success : function(data) {
						$('#id').val(data.id);
						$('#productId').val(data.productId);
						$('#specificationsId').val(data.specificationsId);
						$('#mailId').val(data.mailId);
						$('#actualPrice').val(data.actualPrice);
						$('#mallType').val(data.mallType);
						$('#itemupshelfTotal').val(data.itemupshelfTotal);
						$('#totalInventory').val(data.totalInventory);
						$('#virtualInventory').val(data.virtualInventory);
						$('#sales').val(data.sales);
						$('#returnWing').val(data.returnWing);
						$('#whether').val(data.whether);
						$('#universalCoupon').val(data.universalCoupon);
						$('#discount').val(data.discount);
						$('#goodsDiscount').val(data.goodsDiscount);
						$('#themeActivities').val(data.themeActivities);
						$('#cssId').val(data.cssId);
						$('#createTime').val(data.createTime);
						$('#creater').val(data.creater);
						$('#updateTime').val(data.updateTime);
						$('#updater').val(data.updater);
						$('#conventionalNote').val(data.conventionalNote);
						$('#conventionalRemark').val(data.conventionalRemark);

					}
				});
			}
		}

		function update() {
			$('#form').bootstrapValidator();
			var bootstrapValidator = $("#form").data('bootstrapValidator');
			bootstrapValidator.validate();
		    if(!bootstrapValidator.isValid()){
			   return;
		    }
		    
		    var formdata = $("#form").serializeObject();

			$.ajax({
				type : 'put',
				url : '/tswConventionalGoods',
				contentType: "application/json; charset=utf-8",  
				data : JSON.stringify(formdata),
				success : function(data) {
					layer.msg("修改成功", {shift: -1, time: 1000}, function(){
                        location.href = "tswConventionalGoodList.html";
                    });
				}
			});
		}
		
	</script>
</body>
</html>
